#include "head.h"
/* Usage: */

int work(client_status* user, status_t status){

    while(1){
        sendMsg msg;
        bzero(&msg, sizeof(msg));
        int res_recv = recv(user->net_fd, &msg, sizeof(msg), 0);
        if(res_recv==0 || res_recv==-1){
            printf("用户端关闭\n");
            return 0;
        }
        /*
           if(msgCheck(&msg)==false){

           }*/
        printf("mode = %d\n", msg.mode);
        int mode = msg.mode;
        if(mode==1){
            my_cd(msg, user, user->net_fd);
        } else if(mode==2){
            my_ls(msg, user, user->net_fd);
        } else if(mode==3){
            my_puts(msg, user, user->net_fd);
        } else if(mode==4){
            my_gets(msg, user, user->net_fd);
        } else if(mode==5){
            my_rm(msg, user, user->net_fd);
        } else if(mode==6){
            //my_pwd(msg, user, user->net_fd);
        } else if(mode==-1){
            unlogin(user, user->net_fd);
            return 0;
        }
    }
    
    return 0;    
}

